import BaseModel from "../../cfw/mvc/BaseModel";
import TextureInfo from "../../engine/comps/TextureInfo";
import { EventName, PlayerStateID } from "../../public/Config";
import StateItemModel from "../player/model/StateItemModel";
import Player from "../player/Player";


export default class SmallGameManager extends BaseModel {

    private static ins: SmallGameManager;

    static instance() {
        if (!this.ins) {
            this.ins = new SmallGameManager()
        }
        return this.ins;
    }
    private playerState: StateItemModel;
    // private fillColorName: string = 'fillColorName'
    // private paintColorName: string = 'paintColorName'
    // private fillColorsTexture: TextureInfo[] = []
    // private paintColorTexture: TextureInfo = new TextureInfo();
    // private loadCount: number = 0;
    constructor() {
        super();
        this.playerState = Player.instance().getStateItemModel(PlayerStateID.GAME)
    }

    addNum(num: number) {
        this.playerState.addNum(num)
    }

    updateExp() {
        Player.instance().updateExp(this.playerState)
    }

    init() {
        // for (let index = 0; index < 3; index++) {
        //     let textInfo = new TextureInfo();
        //     textInfo.readFile(this.fillColorName + index, (info) => {
        //         this.fillColorsTexture[index] = info
        //         this.checkLoadResult();
        //     })

        // }
        // this.paintColorTexture.readFile(this.paintColorName, () => {
        //     this.checkLoadResult();
        // })
    }

    // checkLoadResult() {
    //     this.loadCount++;
    //     if (this.loadCount >= 4) {
    //         this.emit(EventName.LOAD_FINISH)
    //     }
    // }

    // getTextureInfo(index: number) {
    //     return this.fillColorsTexture[index]
    // }

    // getPaintColorTexture() {
    //     return this.paintColorTexture;
    // }
}
